import { ORDER_DATA } from '../action/actionTypes'
const initState = {
    orderList: []
}
const getOrderData = (state, action) => {
    let orderList = action.obj.digestlist
    // console.log('orderList', orderList)
    if (action.currentPage === 0) {
        return {
            ...state,
            orderList: orderList
        }
    } else {
        let list = state.orderList
        return {
            ...state,
            orderList: list.concat(orderList)
        }
    }
}
const orderReducer = (state = initState, action) => {
    switch (action.type) {
        case ORDER_DATA:
            return getOrderData(state, action)
        default: return state
    }
}
export default orderReducer